package com.googlecode.allinclusive.fw.core.jms;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class JMSConfig {

	private String initialFactory;
	private String providerUrl;
	private String factoryUrlPkgs;
	private String jmsConnectionFactory;
	public String getInitialFactory() {
		return initialFactory;
	}
	public void setInitialFactory(String initialFactory) {
		this.initialFactory = initialFactory;
	}
	public String getProviderUrl() {
		return providerUrl;
	}
	public void setProviderUrl(String providerUrl) {
		this.providerUrl = providerUrl;
	}
	public String getFactoryUrlPkgs() {
		return factoryUrlPkgs;
	}
	public void setFactoryUrlPkgs(String factoryUrlPkgs) {
		this.factoryUrlPkgs = factoryUrlPkgs;
	}
	public String getJmsConnectionFactory() {
		return jmsConnectionFactory;
	}
	public void setJmsConnectionFactory(String jmsConnectionFactory) {
		this.jmsConnectionFactory = jmsConnectionFactory;
	}
	
	public Context createContext() throws NamingException {
		Properties env = new Properties();
		env.put("java.naming.factory.initial", initialFactory);
		env.put("java.naming.provider.url", providerUrl);
		env.put("java.naming.factory.url.pkgs", factoryUrlPkgs);
		return new InitialContext(env);
	}
}
